package com.yanqu.road.server.cmd.activity.xingyoushanshui.cross;

import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.XingYouShanShuiProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.CurrencyModule;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_XING_YOU_SHAN_SHUI_TRADE_SHIP_REWARD_RECEIVE_FROM_CROSS,desc = "领取(香火祈愿)贸易船奖励-跨服回包")
public class ShanShuiTradeShipRewardReceiveFromCrossCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        XingYouShanShuiProto.ShanShuiTradeShipRewardReceiveRsp rsp = XingYouShanShuiProto.ShanShuiTradeShipRewardReceiveRsp.parseFrom(packet.getBytes());

        if(rsp.getRet() == 0){
            player.getModule(CurrencyModule.class).addCurrency(rsp.getAward(), eLogMoneyType.XingYouShanShuiActivity, eLogMoneyType.XingYouShanShuiWishRoundReward);
        }

        player.sendPacket(Protocol.U_XING_YOU_SHAN_SHUI_TRADE_SHIP_REWARD_RECEIVE, rsp.toBuilder());

    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
